﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace EntityEditorLib
{
    public class EntityEditor
    {

        //TODO: Set as feature properties.
        string SiteUrl = "http://sp2010dev99";

        public SPList CreateEntityStorageList(string entityName, string description){

            //Get a list manager
            ListManagementLib listManager = new ListManagementLib(SiteUrl);

            //Get the list settings
            ListSettings listSettings = listManager.GetListSettings(entityName); //Handy if it exists

            //Set the properties that are required for an Entity storage list
            listSettings.title = entityName;
            listSettings.description = description;
            listSettings.templateStr = "Document Library"; //TODO: Look up rather than just a string
            //settings.contentTypesStr = "Archaeology File;Archaeology Item";
            listSettings.isOnQuickLaunch = true;
            listSettings.isAllowContentTypes = true;
            listSettings.isEnableFolderCreation = false;
            listSettings.isEnableVersioning = true;


            //Create it
            SPList createdList = listManager.CreateList(listSettings);
            return createdList;

        }


    }
}
